#ifndef __LM_GB28_MAN_H__
#define __LM_GB28_MAN_H__

#include <iostream>
#include <map>
#include <pthread.h>

#include "lm_base.h"
#include "lm_device_info.h"


#define MAXCHN  120

class lmGb28Client;
typedef struct 
{
	uchar      runStat; 
	pthread_t *gb28ClientTh;
	deviceInfo_st *dInf;
	lmGb28Client  *gb28Client;
}devAttr_st;


class lmGb28Man
{
	public:
			lmGb28Man();
			~lmGb28Man();
			
	public:
		int lm_start_gb28_man();
		int lm_device_start(deviceInfo_st *devInf, gb_callback_st *gbcb);
		int lm_device_ctrl(uint     serNumb, deviceCtrl_en ctrlNum);
		int lm_device_ctrl_status_get(uint              serNumb, uint &status);
		int lm_get_device_from_list(uint serNumb, deviceInfo_st * &devInf);
		int lm_gb28_client_man_pth_run();

	private:

	private:
		std::map<uint, devAttr_st *> gbDevMap;
		std::map<uint, lmGb28Client *> gbClientMap;
		
	protected:
			pthread_t gb28ManTh;

};


class lmGbSip;
class lmGb28Client
{
	public:
		lmGb28Client(deviceInfo_st *dInf, gb_callback_st *gbcb0);
		~lmGb28Client();
			
	public:
		int lm_gbClient_session_proc(); 
		int lm_check_device_id(char *inDevid);
		int lm_gb28_cmd_proc(char *cmdType);
		int lm_gbClient_status_get(deviceStat_st *pDeviceStatus);
		
		int lm_gbClient_sendRtp_proc();
		int lm_gbClient_media_start(media_para_st *p_mediaPara);
		int lm_device_record_time_get(uint sttime, uint entime, uint itemStime, uint itemEtime);
		media_ctrl_st *lm_gbClient_media_ctrl_get(){return		  &m_mctl;}

		int lm_printf_test(int ddd);

	public:
		media_ctrl_st m_mctl;

	private:
		deviceInfo_st *devInf;
		media_para_st mediaPara;
		lmGbSip *gb28Sip;
		char     playThStat;
		char     playBackThStat;
		char     downThStat;
			
	protected:
			pthread_t gb28clientTh;
			pthread_t mediaSessTh;
			gb_callback_st m_funCb;

};


#endif
